package com.xuecheng.auth.fallback;

import com.xuecheng.auth.feignclient.CheckcodeServiceClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class CheckCodeClientFactory implements FallbackFactory<CheckcodeServiceClient> {
    @Override
    public CheckcodeServiceClient create(Throwable throwable) {
        return new CheckcodeServiceClient() {
            @Override
            public Boolean verify(String key, String code) {
                log.info("调用验证管理服务校验验证码时发生熔断，异常信息:{}",throwable.toString(),throwable);
                return null;
            }
        };
    }
}
